package cn.wolfcode.util;

import com.aliyun.oss.OSSClient;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.Date;
import java.util.Map;
import java.util.UUID;

public class q {
        private static String signkey =  "yanghaoransb";
        private static Long expire = 1000 * 3600 * 24 * 365L;

        public String createToken(Map<String, Object> claims) {
            return Jwts.builder()
                    .addClaims(claims)
                    .setExpiration(new Date(System.currentTimeMillis() + expire))
                    .signWith(SignatureAlgorithm.HS256,signkey)
                    .compact();
        }

        public Claims parseToken(String token) {
            return Jwts.parser().setSigningKey(signkey).parseClaimsJws(token).getBody();
        }

}
